package com.tenbent.product.center.insures.dto;

import com.tenbent.product.base.dto.BaseDto;
import com.tenbent.product.center.insures.bo.SafeguardPackage;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 保障套餐
 *
 * @author Randy
 *
 *         Created by ThinkPad on 2017/8/21.
 */
public class SafeguardPackageDto extends BaseDto {

	/** 产品ID **/
	@NotNull(message = "{product.id.not.empty}")
	private Integer productId;

	/** 套餐代码 **/
	@NotEmpty(message = "{safeguard.package.code.not.empty}")
	private String packageCode;

	/** 套餐名称 **/
	@NotEmpty(message = "{safeguard.package.name.not.empty}")
	private String packageName;

	// ==================以下为业务属性=================================//

	/** 套餐保障明细 */
	// @JsonInclude(JsonInclude.Include.NON_NULL)
	// 此处可以不用配置，因为配置了全局mappingJackson2HttpMessageConverter
	private List<SafeguardPackageDetailDto> safeguardPackageDetails;

	public SafeguardPackageDto() {
	}

	public SafeguardPackageDto(SafeguardPackage safeguardPackage) {
		super(safeguardPackage);
		setProductId(safeguardPackage.getProductId());
		setPackageCode(safeguardPackage.getPackageCode());
		setPackageName(safeguardPackage.getPackageName());
	}

	public SafeguardPackage transToBo() {
		SafeguardPackage safeguardPackage = new SafeguardPackage();
		super.transToBo(safeguardPackage);
		safeguardPackage.setProductId(this.getProductId());
		safeguardPackage.setPackageCode(this.getPackageCode());
		safeguardPackage.setPackageName(this.getPackageName());
		return safeguardPackage;
	}

	public Integer getProductId() {
		return productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}

	public String getPackageCode() {
		return packageCode;
	}

	public void setPackageCode(String packageCode) {
		this.packageCode = packageCode;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public List<SafeguardPackageDetailDto> getSafeguardPackageDetails() {
		return safeguardPackageDetails;
	}

	public void setSafeguardPackageDetails(List<SafeguardPackageDetailDto> safeguardPackageDetails) {
		this.safeguardPackageDetails = safeguardPackageDetails;
	}
}
